package org.rever.string;

public class RevSentances {
	

	public String RevGivenSentence(String sentance){
		 StringBuilder str = new StringBuilder();
		String[] RevSplit = sentance.split(" ");
		System.out.println("The given String is "+sentance);
		System.out.println(" Below is reverced String");
		for (int i = RevSplit.length-1; i >= 0; i--) {
		str	= str.append(RevSplit[i] + " ");
		
		}
		String sent =str.toString();
		return sent;
		
	}
	public static void main (String args[]){
		RevSentances rev =new RevSentances();
		String sentance = "durga and rao are best friends";
		System.out.println(rev.RevGivenSentence(sentance));
		System.out.println("Done");
	}
}
